﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CacheInterfaceLib;

namespace CacheClientLib
{
    public class CacheClient
    {
        private static bool cacheInited = false;

        private static ICacheService cacheService;
        public static ICacheService Service
        {
            get { return cacheService; }
        }

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="host">地址端口号</param>
        /// <param name="serviceName">服务名称</param>
        public static void Init(string host, string serviceName)
        {
            if (!cacheInited)
            {
                string url = string.Format("tcp://{0}/{1}");
                cacheService = Activator.GetObject(typeof(ICacheService), url) as ICacheService;
            }
        }
    }
}
